let express = require('express');
let router = express.Router();
let mongoose = require('mongoose');

//根据所选试卷id，获得所选试卷关联的exercise中的所有内容
//所选试卷id
router.get('/query', async function (req, resp) {
    //获取当前已考试卷的id
    let {testedId} = req.query
    // let testedId ='633583f5765c0000e6005976'
    let re = await mongoose.model('testedsModel').find({
        _id: testedId
    }).populate('studentId').populate('testId')
    if (re) {
        resp.send({
            code: 1,
            message: '查询成绩成功!',
            data: re
        });
    } else {
        resp.send({
            code: 2,
            message: '查询成绩失败!',
        });
    }
});



module.exports = router;
